/*河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
*/
package cn.javaxc.psi.action.supplychainmana;
import java.io.*;
import java.util.*;
import java.sql.*;
import cn.javaxc.model.base.SQL;
import cn.javaxc.model.base.SQLList;
import cn.javaxc.model.base.SQLMap;
import cn.javaxc.model.base.SQLParam;
import cn.javaxc.model.page.BatisPage;
import cn.javaxc.mvcwork.controller.web.TreeBean;
import cn.javaxc.mvcwork.util.common.CommonUtil;
import cn.javaxc.mvcwork.util.common.MapListUtil;
import cn.javaxc.mvcwork.util.helper.FrameHelper;
import cn.javaxc.mvcwork.util.helper.TreeTableHelper;
import org.springframework.beans.factory.annotation.Autowired;
import cn.javaxc.system.action.base.BaseAction;
import cn.javaxc.psi.mapper.supplychainmana.SupplierMapper;
public class SupplierAction extends BaseAction
{
    @Autowired(required=false)
	private SupplierMapper mapper;
    /**
    供应商统计图
    */
    
    public Map cartogramSupplier() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        super.listDepartments();
        
        
        
        
        result.put("s_search", pagination.getSearchParas());
        
        
        SQLList<SQLMap> s_province=mapper.s_province(params);
        s_province.setSelectNone("所有");
        result.put("s_province", s_province);
        
        
        params.def("CMIDprovince",-1);
        SQLList<SQLMap> s_city=mapper.s_city(params);
        s_city.setSelectNone("市");
        result.put("s_city", s_city);
        
        
        params.def("CMIDcity",-1);
        params.def("CMIDprovince",-1);
        SQLList<SQLMap> baidumap=mapper.baidumap(params);
        result.put("baidumap", baidumap);
        
        return result;
    }
    /**
    */
    
    public Object message() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> message=mapper.message(params,pagination);
        message.setPagedListInfo(pagination);
        result.put("message", message);
        
        return message;
    }
    /**
    增加新供应商
    */
    
    public Map supplierAdd() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> clientorigin=mapper.clientorigin(params);
        result.put("clientorigin", clientorigin);
        
        
        SQLList<SQLMap> s_clienttype=mapper.s_clienttype(params);
        result.put("s_clienttype", s_clienttype);
        
        
        SQLList<SQLMap> s_sort=mapper.s_sort(params);
        result.put("s_sort", s_sort);
        
        
        SQLList<SQLMap> s_mode=mapper.s_mode(params);
        result.put("s_mode", s_mode);
        
        
        SQLList<SQLMap> clientbus=mapper.clientbus(params);
        result.put("clientbus", clientbus);
        
        
        result.put("client_message", create_code(getParameter("CMID5"),"client_barcode"));
        
        
        
        return result;
    }
    /**
    供应商搜索
    */
    
    public Map supplierSearchs() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> clienttype=mapper.clienttype(params);
        result.put("clienttype", clienttype);
        
        
        SQLList<SQLMap> clientmode=mapper.clientmode(params);
        result.put("clientmode", clientmode);
        
        
        SQLList<SQLMap> clientorigin=mapper.clientorigin(params);
        result.put("clientorigin", clientorigin);
        
        
        SQLList<SQLMap> clientrate=mapper.clientrate(params);
        result.put("clientrate", clientrate);
        
        
        SQLList<SQLMap> clientbus=mapper.clientbus(params);
        result.put("clientbus", clientbus);
        
        
        SQLList<SQLMap> s_province=mapper.s_province(params);
        result.put("s_province", s_province);
        
        
        params.def("address_province",-1);
        SQLList<SQLMap> s_city=mapper.s_city(params);
        result.put("s_city", s_city);
        
        
        params.def("address_city",-1);
        SQLList<SQLMap> s_district=mapper.s_district(params);
        result.put("s_district", s_district);
        
        
        result.put("s_search", pagination.getSearchParas());
        
        
        
        
        
        return result;
    }
    /**
    查找结果列表
    */
    
    public Map searchList() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> client_list=mapper.client_list(params,pagination);
        client_list.setPagedListInfo(pagination);
        result.put("client_list", client_list);
        
        return result;
    }
    /**
    人员选择
    */
    
    public Map choiceMan() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> person=mapper.person(params);
        result.put("person", person);
        
        return result;
    }
    /**
    供应商搜索
    */
    
    public Map supplierSearch() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> clienttype=mapper.clienttype(params);
        result.put("clienttype", clienttype);
        
        
        SQLList<SQLMap> clientmode=mapper.clientmode(params);
        result.put("clientmode", clientmode);
        
        
        SQLList<SQLMap> clientorigin=mapper.clientorigin(params);
        result.put("clientorigin", clientorigin);
        
        
        SQLList<SQLMap> clientrate=mapper.clientrate(params);
        result.put("clientrate", clientrate);
        
        
        SQLList<SQLMap> clientbus=mapper.clientbus(params);
        result.put("clientbus", clientbus);
        
        
        SQLList<SQLMap> s_province=mapper.s_province(params);
        result.put("s_province", s_province);
        
        
        params.def("address_province",-1);
        SQLList<SQLMap> s_city=mapper.s_city(params);
        result.put("s_city", s_city);
        
        
        params.def("address_city",-1);
        SQLList<SQLMap> s_district=mapper.s_district(params);
        result.put("s_district", s_district);
        
        
        result.put("s_search", pagination.getSearchParas());
        
        return result;
    }
    /**
    选择标准文件测试
    */
    
    public Map standardDocumentBackups() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        result.put("s_search", pagination.getSearchParas());
        
        
        SQLList<SQLMap> s_files=mapper.s_files(params,pagination);
        s_files.setPagedListInfo(pagination);
        result.put("s_files", s_files);
        
        return result;
    }
    /**
    查找结果列表
    */
    
    public Map supplierSearchList() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> client_list=mapper.client_list(params,pagination);
        client_list.setPagedListInfo(pagination);
        result.put("client_list", client_list);
        
        return result;
    }
    /**
    增加新供应商修改
    */
    
    public Map supplierAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int CMID = mapper.CMID(params);
        result.put("CMID", CMID);
        
        
        int CMID2 = mapper.CMID2(params);
        result.put("CMID2", CMID2);
        
        return result;
    }
    public Map ajaxList(){
        String sql="";
        String pagesql="";
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        if(request.getParameter("cfield_name").contains("address_city")){
            SQLList<SQLMap> address_city=mapper.address_city(params);
            result.put("address_city", address_city);
        }
        
        
        if(request.getParameter("cfield_name").contains("address_town")){
            SQLList<SQLMap> address_town=mapper.address_town(params);
            result.put("address_town", address_town);
        }
        
        return result;
    }
    public String ajaxComplete(){
        String sql="";
        String pagesql="";
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        if(request.getParameter("cfield_name").equals("s_client_name")){
            SQLList<SQLMap> s_client_name=mapper.s_client_name(params);
            request.setAttribute("s_client_name", s_client_name);
        }
        
        
        if(request.getParameter("cfield_name").equals("s_s")){
            SQLList<SQLMap> s_s=mapper.s_s(params);
            request.setAttribute("s_s", s_s);
        }
        
        
        if(request.getParameter("cfield_name").equals("s_client_filename")){
            SQLList<SQLMap> s_client_filename=mapper.s_client_filename(params);
            request.setAttribute("s_client_filename", s_client_filename);
        }
        
        
        if(request.getParameter("cfield_name").equals("s_client_name")){
            SQLList<SQLMap> s_client_name=mapper.s_client_name(params);
            request.setAttribute("s_client_name", s_client_name);
        }
        
        
        if(request.getParameter("cfield_name").equals("s_filename")){
            SQLList<SQLMap> s_filename=mapper.s_filename(params);
            request.setAttribute("s_filename", s_filename);
        }
        
        
        if(request.getParameter("cfield_name").equals("s_client_subject")){
            SQLList<SQLMap> s_client_subject=mapper.s_client_subject(params);
            request.setAttribute("s_client_subject", s_client_subject);
        }
        
        return AJAXCOMPLETE;
    }
}